import requests
import time
import hashlib

# 配置参数
app_name = "d90_university" 
app_secret = "44rjmph4-3xym-14ty-7u4o-9lastn176ytn" 
competitionStageUUID = "6AL6KcnQaKBb"
url = "https://bdapi.gameyw.netease.com/compete_api/i/v1/d90/comp/team/rank_list?competition_stage_uuid=6AL6KcnQaKBb&complete_stage_list=0"

# 获取当前时间戳（秒级）
timestamp = int(time.time())

# 构建 X-Request-Token
token_string = f"{app_name}_{timestamp}_{app_secret}"
x_request_token = hashlib.md5(token_string.encode()).hexdigest()
headers = {
    "X-Request-User": app_name,
    "X-Request-Ts": str(timestamp),
    "X-Request-Token": x_request_token
}

response = requests.get(url, headers=headers)

# 检查响应
if response.status_code == 200:
    print("请求成功:\n", response.json())
else:
    print("请求失败:\n", response.status_code, response.text)


{
    "code": 200,
    "message": "OK",
    "data": {
        "competition_stage_id": 339123,  # 赛事阶段ID
        "schedule_id": 234213,  #赛程ID
        "competition_stage_uuid": "7ysqNV2RP9pR", # 赛事阶段UUID
        "room_id": "2771680ba8aa434dad1bbdbb1f8902a5",
        "battle_tid": 5000005,
        "num_high_resource_district": 7, #资源区域数量
        "id_scene_pointrule_group": [  #区域代表id
            10002,
            10003,
            10004,
            10005,
            10007,
            10012,
            10021
        ],
        "team":[
            {
                "team_id":459004,
                "team_name":"0428test02",
                "role_info":[
                    {
                        "role_id":"cd42000000105500000198",
                        "role_name":"永劫赛事OB05",
                        "born_postion":[
                            1037.75,
                            96.92742156982422,
                            854.25
                        ],
                        "hero_id":1000015,
                        "player_name":"永劫赛事OB05",                        
                        "telents":[  #天赋
                            {
                                "talent_id":3442002, #ID
                                "talent_level":5,  #等级
                                "talent_count":5,  #数量
                                "talent_name":"本源·气运",  #名称
                                "talent_rank":1,  #排名
                                "talent_effects":[  #效果
                                    {
                                        "effect_mame":"幸运值",  #效果名称
                                        "effect_value":50  #效果加成值
                                    },
                                    {
                                        "effect_mame":"每10秒获得暗潮币",
                                        "effect_value":750
                                    }
                                ]
                            }
                        ],
                        "skills":[  #技能
                            {
                                "skill_id":3470070, #ID
                                "skill_name":"陷阵",  #名称
                                "skill_rank":1  #排名
                            },
                            {
                                "skill_id":3470073,
                                "skill_name":"千军辟易",
                                "skill_rank":2
                            }
                        ]                        
                    },
                    {
                        "role_id":"f37c000000105700000198",
                        "role_name":"永劫赛事OB07",
                        "born_postion":[
                            1076.75,
                            105.89852142333984,
                            875.7498779296875
                        ],
                        "hero_id":1000013,
                        "player_name":"永劫赛事OB07"
                    }
                ]
            },
            {
                "team_id":459005,
                "team_name":"0506 test",
                "role_info":[
                    {
                        "role_id":"d1rj000000105600000198",
                        "role_name":"永劫赛事OB01",
                        "born_postion":[
                            1110.25,
                            116.12635040283203,
                            893.25
                        ],
                        "hero_id":1000006,
                        "player_name":"永劫赛事OB01"
                    }
                ]
            },
            {
                "team_id":459006,
                "team_name":"0506 test2",
                "role_info":[
                    {
                        "role_id":"1s2s000000105800000198",
                        "role_name":"永劫赛事OB02",
                        "born_postion":[
                            516.7501220703125,
                            55.82976531982422,
                            1284.2498779296875
                        ],
                        "hero_id":0,
                        "player_name":"永劫赛事OB02"
                    }
                ]
            }
        ],
        "match_round": 1  # 局次
    }
}




{
    "code": (int),
    "data": [
        {
            "team_id": (int),
            "team_name": (string),
            "hero_id": (list<int>),
            "pick_count": (int),
            "pick_rate": (float),
            "average_score": (float),
            "average_kill": (float)
        },
        ...
    ],
    "message": (string)
}



{
    "code": 200,
    "data": {
        "match_name": "h55", # 赛局名
        "teams": [
            {
                "team_uuid": "87dg57n48Mri", # 队伍uuid
                "team_name": "Lm", 队伍名
                "team_logo_url": "https:\/\/ok.166.net\/gameyw-misc\/h5\/static\/20220630\/180233-osyu8p2f96.png",
                "team_from": "赛区",
                "srv_rank": 1, # 生存排名
                "kill_times": 15, # 击杀数
                "damage": 52499, # 伤害数
                "rank": 1, # 积分排名
                "rank_score": 2,  # 排名分
                "kill_score": 7,  # 击杀分
                "score": 11,  # 积分（含局补尝分）
                "players": [
                    {
                        "team_uuid":"4Fp4QpVCvRyd",
                        "role_id":"3k28000000120700000197",
                        "hero_id":1000016,  # 英雄id
                        "player_game_name":"YZG.QGG",
                        "melee_damage":9283,  # 近战伤害
                        "kill_in_reborn_period":1,  # 返魂期击杀
                        "weapon_with_damage_3":[  # 伤害前三
                            "长剑, 9158.0",
                            "火炮, 5517.0",
                            "连弩, 1051.0"
                        ],
                        "kill_times":2,  # 击杀数
                        "damage":17436,  # 伤害
                        "cure":11490.0576,  # 治疗
                        "rescue_times":1,  # 救援
                        "assist_count":5,  # 助攻
                        "total_live_time":1740.4699704647064,  # 生存时长
                        "shock_count":1,  # 振刀
                        "soul_items_tids":[  # 魂玉
                            3323501,
                            3323341,
                            3325000,
                            3323506,
                            3325010,
                            3323231
                        ],
                        "talent_skill_tid":[  # 技能
                            3470112,
                            3470115
                        ],
                        "user_logo_url":"https:\/\/ok.166.net\/gameyw-misc\/h5\/static\/20230307\/155913-s8zk902dbl.png",
                        "enc_role_id":"iZmwTZIBk88AAAABdHdsTZPOC6JWsgsaxBZp7ocfvcCnJogcTxu-VMdUighT7NR3"  # 加密role_id
                    },
                    {
                        "team_uuid":"4Fp4QpVCvRyd",
                        "role_id":"4tbt000000120600000197",
                        "hero_id":1000005,
                        "player_game_name":"YZG.Cxz",
                        "melee_damage":1307,
                        "kill_in_reborn_period":0,
                        "weapon_with_damage_3":[
                            "一窝蜂, 3995.0",
                            "技能奥义, 1974.0",
                            "连弩, 1566.0"
                        ],
                        "kill_times":1,
                        "damage":9076,
                        "cure":8983.96534,
                        "rescue_times":1,
                        "assist_count":3,
                        "total_live_time":1763.2959470748901,
                        "shock_count":0,
                        "soul_items_tids":[
                            3320011,
                            3323401,
                            3323603,
                            3323111,
                            3320051,
                            3320001
                        ],
                        "talent_skill_tid":[
                            3470018,
                            3470023
                        ],
                        "user_logo_url":"https:\/\/ok.166.net\/gameyw-misc\/h5\/static\/20230307\/155037-l2jsg7eobu.png",
                        "enc_role_id":"iZmwTZIBk88AAAABdHdsTZPOC6JWsgsaxBZu8ddTvcCnJogcTxu-VcdUighT7NR3"
                    },
                    {
                        "team_uuid":"4Fp4QpVCvRyd",
                        "role_id":"ih1s000000121000000197",
                        "hero_id":1000007,
                        "player_game_name":"YZG.xiaohuToT",
                        "melee_damage":5964,
                        "kill_in_reborn_period":2,
                        "weapon_with_damage_3":[
                            "技能奥义, 14383.0",
                            "火炮, 10329.0",
                            "阔刀, 3054.0"
                        ],
                        "kill_times":6,
                        "damage":30676,
                        "cure":7383.252469793323,
                        "rescue_times":0,
                        "assist_count":3,
                        "total_live_time":1753.3240296840668,
                        "shock_count":0,
                        "soul_items_tids":[
                            3325240,
                            3323361,
                            3320001,
                            3322001,
                            3320001,
                            3323331
                        ],
                        "talent_skill_tid":[
                            3470031,
                            3470033
                        ],
                        "user_logo_url":"https:\/\/ok.166.net\/gameyw-misc\/h5\/static\/20230307\/160413-p18ef0qglr.png",
                        "enc_role_id":"iZmwTZIBk88AAAABdHdsTZPOC6JWsgsaxBYz7YRUvcCnJogcTxu_U8dUighT7NR3"
                    }
                ]
            },
            ......
        ]
    },
    "message": "OK"
}